package com.zhentao.controller;

import com.zhentao.model.common.dtos.PermissionResult;
import com.zhentao.model.pojo.user.gift.ChargeUserGift;
import com.zhentao.service.SysUserService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user/info")
public class AdminGIftsController {

    @Resource
    private SysUserService sysUserService;


    @GetMapping("/getGifts")
    public PermissionResult getGifts(){
        return sysUserService.getGifts();
    }

    @PostMapping("/saveGift")
    public PermissionResult saveGift(@RequestBody ChargeUserGift gift){
        return sysUserService.saveGift(gift);
    }

    @PostMapping("/uploadImg")
    public PermissionResult uploadImg(@RequestBody MultipartFile file){
        return sysUserService.uploadImg(file);
    }

    @PostMapping("/updateGift")
    public PermissionResult updateGift(@RequestBody ChargeUserGift gift){
        return sysUserService.updateGift(gift);
    }

    @PostMapping("/deleteGift")
    public PermissionResult deleteGift(@RequestBody ChargeUserGift chargeUserGift){
        return sysUserService.deleteGift(chargeUserGift.getId());
    }
}
